package com.antg.service;

import com.antg.util.FileUtils;

import java.io.File;
import java.util.List;

/**
 * @Description: 任务生成器
 * @Author 子兔Antg
 * @Date 2021/10/30
 **/
public class TaskGenerator {

    private String filePath;

    public TaskGenerator(String file) {
        this.filePath = file;
    }

    //生成任务列表
    public List<String> generate() throws Exception {
        File file = new File(filePath);
        if(!file.exists()){
            throw new Exception("路径不存在");
        }
        if(!file.isDirectory()){
            throw new Exception("该路径不是一个目录");
        }
        return FileUtils.getSubFilePaths(file);
    }
}
